package cn.j0n4than.accountingtool.controller.api.user;

import cn.j0n4than.accountingtool.config.ResponseConfig;
import cn.j0n4than.accountingtool.entity.Type;
import cn.j0n4than.accountingtool.utils.Response;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 用户支出类型控制器
 *
 * @author jonathan
 */
@RestController
@RequestMapping("/api/user/type")
public class UserTypeController extends UserBaseController {

    /**
     * 获取支出类型列表
     *
     * @return Response
     */
    @GetMapping("/getList")
    public Response getList() {
        Response response = Response.response();
        List<Type> list = this.typeService.getList(new Type(), this.getCurrentUser().id);
        return response
                .setStatus(ResponseConfig.SUCCESS)
                .setMessage("success")
                .setResult("typeList", list);
    }
}
